﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AForge;
using AForge.Neuro;

using AIthin.Controls;


namespace AIthin.Model
{
    public partial class NeuroNetworkForm : Form
    {
        public NeuroControl NC;
        //TODO can be better, one cosructor calling another
        public NeuroNetworkForm()
        {
            InitializeComponent();
            this.NC = new NeuroControl();
            this.NC.Location = new System.Drawing.Point(12, 12);
            this.NC.Name = "NC";
            this.NC.Size = new System.Drawing.Size(613, 248);
            this.Controls.AddRange(new System.Windows.Forms.Control[] { this.NC });
            NC.Show();
        }

        private void NeuroNetworkForm_FormClosing(object sender, FormClosingEventArgs e)
        {
               this.NC.SaveNetworkFile(AIthin.Model.Properties.Settings.Default.WorkingPath, NC.NetworkName + ".nw");
        }

        public void LoadNetworkFile()
        {
            openNNFileDialog.InitialDirectory = AIthin.Model.Properties.Settings.Default.WorkingPath;
            openNNFileDialog.ShowDialog();
            NC.LoadNetworkFile(AIthin.Model.Properties.Settings.Default.WorkingPath, openNNFileDialog.SafeFileName);
        }

        public void LoadNetworkFile(String Path, String FileName)
        {
            NC.LoadNetworkFile(Path, FileName);
        }
    }
}
